import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home.vue'
import Main from '@/views/Main.vue'
import ResourceCrud from '@/components/ResourceCrud.vue'
// import CoursesList from '@/views/courses/List.vue'
// import CoursesEdit from '@/views/courses/Edit.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    component: Main,
    children: [
      {
        path: '/',
        name: 'home',
        component: Home,
      },
      {
        path: '/:resource/list',
        props: true,
        name: 'coursesCrud',
        component: ResourceCrud,
      },
      // {
      //   path: '/courses/list',
      //   name: 'coursesList',
      //   component: CoursesList,
      // },
      // {
      //   path: '/courses/edit/:id',
      //   name: 'coursesEdit',
      //   component: CoursesEdit,
      //   props: true,
      // },
      // {
      //   path: '/courses/create',
      //   name: 'coursesCreate',
      //   component: CoursesEdit,
      // },
    ],
  },
]

const router = new VueRouter({
  routes,
})

export default router
